home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / cstrings.arc / LEFT.C < prev    next >
Encoding:
Text File  |  1985-08-06  |  1.4 KB  |  49 lines

  1. /*
  2.     CSTRINGS.LBR VERSION 1.0
  3.     Spark Software, Inc.
  4.  
  5.         If you find this software of use, it is requested that you send
  6.         a donation ($10.00 suggested) to:
  7.  
  8.             Spark Software, Inc.
  9.             24 Royal Crest Dr., #5
  10.             Nashua, NH  03060
  11.  
  12.         Upon receiving your donation, your name will be added to the 
  13.         List of Registered Users, and future updates can be obtained
  14.         from the SPARKIE RBBS at (603) 888-8179.
  15.  
  16.         If you include an extra $10.00 with your donation, the newest
  17.         version of CSTRINGS.LBR will be mailed to you.
  18.  
  19.         Call SPARKIE RBBS at the number above for other Spark Software
  20.         products!!!
  21. */
  22.  
  23. /*
  24.  *    char *
  25.  *    left (dest, str, n)
  26.  *    char *dest, *str;
  27.  *    int n;
  28.  *
  29.  *    This function returns a pointer to a string (dest) containing
  30.  *    the leftmost n characters from str.  Note that dest is assumed
  31.  *    to be large enough to hold the entire resulting string.
  32.  *    Note that the external declaration is necessary for some compilers
  33.  *    (including Lattice C large model) that have different sizes for
  34.  *      int's and char *'s.
  35.  */
  36.  
  37. char *left (dest, str, n)
  38. register char *dest, *str;
  39. register int n;
  40. {
  41.     extern char *strncpy ();
  42.  
  43.                     /* Copy the characters into the
  44.                        new string, and return the pointer
  45.                        to the result */
  46.     return (strncpy (dest, str, n));
  47.  
  48. } /* left */
  49.